pub enum Log {
    Error(&'static str),
    /// The "warn" level.
    ///
    /// Designates hazardous situations.
    Warn(&'static str),
    /// The "info" level.
    ///
    /// Designates useful information.
    Info(&'static str),
    /// The "debug" level.
    ///
    /// Designates lower priority information.
    Debug(&'static str),
    /// The "trace" level.
    ///
    /// Designates very low priority, often extremely verbose, information.
    Trace(&'static str),
}

#[derive(Default)]
pub struct Logger {
    engine_log: Vec<Log>,
    client_log: Vec<Log>,
    max_engine_log_count: usize,
    max_client_log_count: usize,
    interval: usize,
}

impl Logger {
    pub fn init(&mut self) {
        let env = env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "trace");
        let mut builder = env_logger::Builder::from_env(env);
        println!("builder = {:?}", builder);
        builder
            .format(|buf, record| {
                use std::io::Write;
                if record.target() != "wgpu_core::device" {
                    let level = { buf.default_styled_level(record.level()) };
                    write!(buf, "{}", format_args!("{:>5}", level))?;
                    writeln!(buf, "{} , {}", &record.target(), &record.args())?;
                }
                Ok(())
            })
            .init();

        info!("log system init");
    }

    fn engine_log(&mut self , log:&'static str) {
        self.engine_log.push(Log::Info(log))
    }
}


